package net.madarco.phpsense.util;

import java.io.IOException;
import java.io.OutputStream;

import com.caucho.vfs.StreamImpl;

public class OutputStreamConsole extends StreamImpl {
	private OutputStream _out;

	public OutputStreamConsole(OutputStream out) {
		_out = out;
	}

	/**
	 * Returns true if this is a writable stream.
	 */
	public boolean canWrite() {
		return true;
	}

	/**
	 * Writes a buffer to the underlying stream.
	 * 
	 * @param buffer
	 *            the byte array to write.
	 * @param offset
	 *            the offset into the byte array.
	 * @param length
	 *            the number of bytes to write.
	 * @param isEnd
	 *            true when the write is flushing a close.
	 */
	public void write(byte[] buffer, int offset, int length, boolean isEnd)
			throws IOException {
		_out.write(buffer, offset, length);
	}
}